package com.zyw.auth.controller;

import com.zyw.auth.service.CaptchaService;
import com.zyw.common.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;


/**
 * 验证码 + UUID
 */
@Controller("captchaController")
@RequestMapping("/captcha")
public class CaptchaController {

    @Autowired
    private CaptchaService captchaService;


    /**
     * 生成验证码图片 & UUID
     */
    @GetMapping("/imageAndUuid")
    @ResponseBody
    public RespResult<Map<String,String>> imageAndUuid() {
        Map<String,String> res = captchaService.generateImageAndUuid();
        return new RespResult().addSuccess(res);
    }

}
